local yanzhen = fk.CreateSkill{
    name = "XD__yanzhen"
}
Fk:loadTranslationTable{
    ["XD__yanzhen"] = "演阵",
    [":XD__yanzhen"] = "回合技，当你使用的目标为一名其他角色的牌被目标角色使用的牌抵消时，或其他角色使用的目标为你的牌被你使用的牌抵消时，你可以令两名角色分别获得双方使用的牌。",
    ["#XD__yanzhen"] = "演阵：是否令 %src 获得%arg，%dest 获得%arg2",
}

yanzhen:addEffect(fk.CardUsing, {
    anim_type = "control",
    can_trigger = function (self, event, target, player, data)
        if player:hasSkill(yanzhen.name) and data.responseToEvent and player:usedSkillTimes(yanzhen.name, Player.HistoryTurn) == 0 and
        data.responseToEvent.card and player.room:getCardArea(data.responseToEvent.card) == Card.Processing and data.card and
        player.room:getCardArea(data.card) == Card.Processing then
            if data.responseToEvent.from == player and target ~= player then
                return data.responseToEvent:isOnlyTarget(data.responseToEvent.tos[1]) and data.responseToEvent.tos[1] ~= player
            elseif data.responseToEvent.from ~= player and target == player then
                return data.responseToEvent:isOnlyTarget(player)
            end
        end
    end,
    on_cost = function (self, event, target, player, data)
        local card1, card2 = data.card, data.responseToEvent.card
        local src, dest = data.responseToEvent.from, player
        if data.responseToEvent.from == player then
            card1, card2 = data.responseToEvent.card, data.card
            src, dest = target, data.responseToEvent.from
        end
        if player.room:askToSkillInvoke(player, {
            skill_name = yanzhen.name,
            prompt = "#XD__yanzhen:"..src.id..":"..dest.id..":"..card1:toLogString()..":"..card2:toLogString()
        }) then
            return true
        end
    end,
    on_use = function (self, event, target, player, data)
        local room = player.room
        if data.responseToEvent.from == player then
            room:obtainCard(player, data.card, true, fk.ReasonJustMove, player, yanzhen.name)
            room:obtainCard(target, data.responseToEvent.card, true, fk.ReasonJustMove, player, yanzhen.name)
        else
            room:obtainCard(player, data.responseToEvent.card, true, fk.ReasonJustMove, player, yanzhen.name)
            room:obtainCard(data.responseToEvent.from, data.card, true, fk.ReasonJustMove, player, yanzhen.name)
        end
    end,
})

return yanzhen